/*  File Name	: Heap.h
 *  Author		: Javie Pong
 *	 E-mail		: 823960168@qq.com
 *  Created on	: 2012-5-12
 *  Description:
 */

#ifndef HEAP_H_
#define HEAP_H_
#include <stdlib.h>
class Heap
{
public:
	Heap();
	Heap(int size);
	virtual ~Heap();

	int open(int size);
	int pop(int64_t &p);
	int push(int64_t p);
	float timeval_msec_diff(const struct timeval *start, const struct timeval *end);
	int sort(void);
private:

	int adjust(int node,int len);

	int64_t *heap_;
	int max_size_;
	int cur_size_;
};

#endif /* HEAP_H_ */
